/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2024-06-19
 * Time: 20:15
 */
//饿汉模式
class Singleton {
    private static Singleton instance = new Singleton();
    public static  Singleton getInstance() {
        return instance;
    }

    private Singleton() {
    }
}
public class Deom22 {
    public static void main(String[] args) {
        Singleton.getInstance();
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        System.out.println(s1 == s2);
    }
}
